<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Getting Started</title>
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="../../../index.html" title="ODTONE 0.3">
<link rel="up" href="../link_sap_index.html" title="Link SAP">
<link rel="prev" href="../link_sap_index.html" title="Link SAP">
<link rel="next" href="../client_index.html" title="Client">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="'ODTONE - Open Dot Twenty One'" width="100" height="100" src="../../.././images/logo.png"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../link_sap_index.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../link_sap_index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../client_index.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
</div>
<div class="section" title="Getting Started">
<div class="titlepage"><div><div><h4 class="title">
<a name="odtone.app.link_sap_index.link_sap_getStart"></a><a class="link" href="link_sap_getStart.html" title="Getting Started"> Getting
        Started</a>
</h4></div></div></div>
<div class="section" title="Detailed Description">
<div class="titlepage"><div><div><h5 class="title">
<a name="odtone.app.link_sap_index.link_sap_getStart.detailed_description"></a><a class="link" href="link_sap_getStart.html#odtone.app.link_sap_index.link_sap_getStart.detailed_description" title="Detailed Description">Detailed
          Description</a>
</h5></div></div></div>
<p>
            Link SAP has two different implementation: one for Linux and other one
            for Windows. However, they do the exactly same thing. The Linux implementation
            use <span class="emphasis"><em>rtnetlink</em></span> and <span class="emphasis"><em>netlink</em></span> libraries
            to manage network interfaces, while windows implementation use Windows
            SDK libraries.
          </p>
<p>
            As this is a simple Link SAP, it only supports link down and link up
            events.
          </p>
<p>
            <span class="inlinemediaobject"><img src="../../.././images/link_sap_state_machine.png" alt="link_sap_state_machine"></span>
          </p>
<p>
            When Link SAP begins to run, it will send a Link_Register.indication
            message to the MIHF. Then, it stays in a state of waiting for messages
            from the network interfaces. When an incoming message is receive, Link
            SAP sends it to the event handler: 
</p>
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">link_sap</span><span class="special">::</span><span class="identifier">link_sap</span><span class="special">::</span><span class="identifier">update</span><span class="special">(</span><span class="identifier">nic</span><span class="special">::</span><span class="identifier">interface</span><span class="special">*</span> <span class="identifier">it</span><span class="special">);</span>
</pre>
<p>
          </p>
<p>
            In the event handler, is verified if the state of network interface has
            been changed. If its state was changed, Link SAP will send a message
            to MIHF notifying it about the succeeded. Otherwise, it won't do nothing
            and will discard the message received.
          </p>
<div class="note" title="Note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../doc/html/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
              Note that this implementation only process link up and link down events.
            </p></td></tr>
</table></div>
<p>
            After this cycle, Link SAP enters in the state of waiting for messages
            from the network interfaces. When a new message is received the cycle
            begins.
          </p>
</div>
<div class="section" title="Configuration">
<div class="titlepage"><div><div><h5 class="title">
<a name="odtone.app.link_sap_index.link_sap_getStart.configuration"></a><a class="link" href="link_sap_getStart.html#odtone.app.link_sap_index.link_sap_getStart.configuration" title="Configuration">Configuration</a>
</h5></div></div></div>
<pre class="programlisting"><span class="identifier">MIH</span> <span class="identifier">Link</span> <span class="identifier">SAP</span> <span class="identifier">Configuration</span><span class="special">:</span>
   <span class="special">--</span><span class="identifier">help</span>                           <span class="identifier">Display</span> <span class="identifier">configuration</span> <span class="identifier">options</span>
   <span class="special">--</span><span class="identifier">link</span><span class="special">.</span><span class="identifier">port</span> <span class="identifier">arg</span> <span class="special">(=</span><span class="number">1234</span><span class="special">)</span>          <span class="identifier">Port</span>
   <span class="special">--</span><span class="identifier">link</span><span class="special">.</span><span class="identifier">tec</span> <span class="identifier">arg</span>                   <span class="identifier">Link</span> <span class="identifier">SAP</span> <span class="identifier">Technology</span>
   <span class="special">--</span><span class="identifier">link</span><span class="special">.</span><span class="identifier">link_addr_list</span> <span class="identifier">arg</span>        <span class="identifier">Link</span> <span class="identifier">SAP</span> <span class="identifier">Interface</span> <span class="identifier">Address</span>
   <span class="special">--</span><span class="identifier">link</span><span class="special">.</span><span class="identifier">event_list</span> <span class="identifier">arg</span>            <span class="identifier">List</span> <span class="identifier">of</span> <span class="identifier">supported</span> <span class="identifier">events</span>
   <span class="special">--</span><span class="identifier">link</span><span class="special">.</span><span class="identifier">command_list</span> <span class="identifier">arg</span>          <span class="identifier">List</span> <span class="identifier">of</span> <span class="identifier">supported</span> <span class="identifier">commands</span>
   <span class="special">--</span><span class="identifier">conf</span><span class="special">.</span><span class="identifier">file</span> <span class="identifier">arg</span> <span class="special">(=</span><span class="identifier">link_sap</span><span class="special">.</span><span class="identifier">conf</span><span class="special">)</span> <span class="identifier">Configuration</span> <span class="identifier">File</span>
   <span class="special">--</span><span class="identifier">conf</span><span class="special">.</span><span class="identifier">recv_buff_len</span> <span class="identifier">arg</span> <span class="special">(=</span><span class="number">4096</span><span class="special">)</span> <span class="identifier">Receive</span> <span class="identifier">Buffer</span> <span class="identifier">Length</span>
   <span class="special">--</span><span class="identifier">mihf</span><span class="special">.</span><span class="identifier">ip</span> <span class="identifier">arg</span> <span class="special">(=</span><span class="number">127.0</span><span class="special">.</span><span class="number">0.1</span><span class="special">)</span>       <span class="identifier">Local</span> <span class="identifier">MIHF</span> <span class="identifier">Ip</span>
   <span class="special">--</span><span class="identifier">mihf</span><span class="special">.</span><span class="identifier">local_port</span> <span class="identifier">arg</span> <span class="special">(=</span><span class="number">1025</span><span class="special">)</span>    <span class="identifier">MIHF</span> <span class="identifier">Local</span> <span class="identifier">Communications</span> <span class="identifier">Port</span>
   <span class="special">--</span><span class="identifier">mihf</span><span class="special">.</span><span class="identifier">id</span> <span class="identifier">arg</span> <span class="special">(=</span><span class="identifier">local</span><span class="special">-</span><span class="identifier">mihf</span><span class="special">)</span>      <span class="identifier">Local</span> <span class="identifier">MIHF</span> <span class="identifier">Id</span>
   <span class="special">--</span><span class="identifier">link</span><span class="special">.</span><span class="identifier">id</span> <span class="identifier">arg</span> <span class="special">(=</span><span class="identifier">link</span><span class="special">)</span>            <span class="identifier">Link</span> <span class="identifier">SAP</span> <span class="identifier">Id</span>
</pre>
<div class="note" title="Note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../doc/html/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top">
<p>
              <span class="bold"><strong>Link SAP Technology</strong></span>
            </p>
<p>
              Network interface card technology.
            </p>
<p>
              Usage: tec = &lt;NIC technology&gt;
            </p>
<p>
              <span class="bold"><strong>Link SAP Interface Address</strong></span>
            </p>
<p>
              Network interface card address.
            </p>
<p>
              Usage: link_addr_list = &lt;interface address&gt;
            </p>
<p>
              <span class="bold"><strong>Link SAP List of supported events</strong></span>
            </p>
<p>
              Comma separated list of the Link SAP's supported events.
            </p>
<p>
              Usage: event_list = &lt;link event 1&gt;, &lt;link event 2&gt;, (...),
              &lt;link event N&gt;
            </p>
<p>
              <span class="bold"><strong>Link SAP List of supported events</strong></span>
            </p>
<p>
              Comma separated list of the Link SAP's supported commands.
            </p>
<p>
              Usage: command_list = &lt;link command 1&gt;, &lt;link command 2&gt;,
              (...), &lt;link command N&gt;
            </p>
<p>
            </p>
</td></tr>
</table></div>
<p>
            Link SAP can be configured either through a configuration file or passing
            directly, in command line, the configuration options.
          </p>
</div>
<div class="section" title="Extending">
<div class="titlepage"><div><div><h5 class="title">
<a name="odtone.app.link_sap_index.link_sap_getStart.extending"></a><a class="link" href="link_sap_getStart.html#odtone.app.link_sap_index.link_sap_getStart.extending" title="Extending">Extending</a>
</h5></div></div></div>
<p>
            It is possible to do several extensions to Link SAP in a simple and fast
            way.
          </p>
<p>
            For example, in event handler can be added specific behaviour for other
            type of event message received. So, Link SAP can notify MIHF about other
            changes in the network interface.
          </p>
<p>
            
</p>
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">link_sap</span><span class="special">::</span><span class="identifier">link_sap</span><span class="special">::</span><span class="identifier">update</span><span class="special">(</span><span class="identifier">nic</span><span class="special">::</span><span class="identifier">interface</span><span class="special">*</span> <span class="identifier">it</span><span class="special">);</span>
</pre>
<p>
          </p>
</div>
<div class="section" title="Running">
<div class="titlepage"><div><div><h5 class="title">
<a name="odtone.app.link_sap_index.link_sap_getStart.running"></a><a class="link" href="link_sap_getStart.html#odtone.app.link_sap_index.link_sap_getStart.running" title="Running">Running</a>
</h5></div></div></div>
<p>
            There is no running recommendation for Link SAP. It can be run after
            or before the local MIHF.
          </p>
<p>
            So that the Link SAP detects some events, you should proceed to disconnect,
            disable or shutdown your network cable/interface or your wireless card
            according to your configuration file.
          </p>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2009 -2011 Universidade Aveiro<br>Copyright &#169; 2009 -2011 Instituto de Telecomunica&#231;&#245;es - P&#243;lo Aveiro<p>
        This software is distributed under a license. The full license agreement
        can be found in the LICENSE in this distribution. This software may not be
        copied, modified, sold or distributed other than expressed in the named license
        agreement. This software is distributed without any warranty.
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../link_sap_index.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../link_sap_index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../client_index.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
</div>
</body>
</html>
